//
//  PPNetEngine.h
//  PPNetworking
//
//  Created by 邓标祥 on 2020/12/15.
//

#import <Foundation/Foundation.h>
#import "PPNetRequest.h"
NS_ASSUME_NONNULL_BEGIN

typedef void (^PPNetCompletionHandler) (id _Nullable responseObject, NSError * _Nullable error);

@interface PPNetEngine : NSObject

+ (instancetype)sharedEngine;


/// 发送请求
/// @param request request
/// @param completionHandler completionHandler
- (void)sendRequest:(PPNetRequest *)request
  completionHandler:(nullable PPNetCompletionHandler)completionHandler;


/// 根据唯一的任务标识取消对应的请求
/// @param identifier 唯一标识
- (void)cancelRequestByIdentifier:(NSString *)identifier;


/// 取消全部正在请求中的任务
- (void)cancelAllOperations;
@end

NS_ASSUME_NONNULL_END
